#include <iostream>
#include <string>
using namespace std;
string to_low(string s)
{
	for(auto & c : s)
	{
		if(c >= 'A' && c <= 'Z')
		{
			c-=32;
		}
	}
	return s;
}
int main()
{
    string s1,s2;
	cin >> s1 >> s2;
	if(s1.size() != s2.size())
	{
	   cout << "1" << endl;	
    }
    else if(s1 == s2)
    {
    	cout << "2" << endl;
	}
	else if(to_low(s1) == to_low(s2))
	{
		cout << "3" << endl;
	}
	else
	  cout << "4" << endl;
}
